package com.example.indenture.order.service.impl;

import com.example.indenture.order.dao.OrdersDao;
import com.example.indenture.order.entity.Orders;
import com.example.indenture.order.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
@Service
public class OrdersServiceImpl implements OrdersService {
    @Autowired
    private OrdersDao ordersDao;


    @Override
    @Transactional
    public int insertOrder(Orders order) {
        return ordersDao.insert(order) == 1 ? 1 : 0;
    }

    @Override
    @Transactional
    public int updateOrder(Orders order) {
        return ordersDao.update(order) == 1 ? 1 : 0;
    }

    @Override
    public Orders getOrdersByOrderId(Integer orderId) {
        return ordersDao.selectOrderById(orderId);
    }
}
